//
//  GangCaiSelectAlert.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/6/3.
//

#import "GangCaiSelectAlert.h"
#import "CommonUtil.h"
#import "LineBtnView.h"



@interface GangCaiSelectAlert()
@property (strong, nonatomic) UIView * lineView1;
@property (strong, nonatomic) UIView * lineView2;
@property (strong, nonatomic) UIView * lineView3;
@property (strong, nonatomic) UIView * lineView4;
@property (strong, nonatomic) UIView * lineView5;
@property (strong, nonatomic) LineBtnView * bangdanView;
@property (strong, nonatomic) LineBtnView * sortView;
@property (strong, nonatomic) LineBtnView * statusView;
@property (strong, nonatomic) LineBtnView * moreView;
@property (strong, nonatomic) UIButton * doneBtn;
@end

@implementation GangCaiSelectAlert

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
    }
    return self;
}

-(void)show{
    [self addSubview:self.whiteView];
    self.whiteView.frame = CGRectMake(0, 0, SCREEN_WIDTH, AD(340));
    self.whiteView.centerY = SCREEN_HEIGHT/2;
    
    [self.whiteView addSubview:self.bangdanView];
    [self.whiteView addSubview:self.sortView];
    [self.whiteView addSubview:self.statusView];
    [self.whiteView addSubview:self.moreView];
    [self.whiteView addSubview:self.lineView1];
    [self.whiteView addSubview:self.lineView2];
    [self.whiteView addSubview:self.lineView3];
    [self.whiteView addSubview:self.lineView4];
    [self.whiteView addSubview:self.lineView5];
    [self.whiteView addSubview:self.doneBtn];

    
    
    
    
    
}

- (void)btnClick:(UIButton *)sender{
    if (self.actionBlock) {
        
        NSArray *arr = @[self.bangdanView.selectBtn.titleLabel.text,self.sortView.selectBtn.titleLabel.text,self.statusView.selectBtn.titleLabel.text,self.moreView.selectBtn.titleLabel.text];
        
        self.actionBlock(arr);
    }
    [self dismiss];
}


#pragma mark - lazy


-(UIView *)lineView1{
    if (!_lineView1) {
        _lineView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.whiteView.width, AD(1))];
        _lineView1.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    }
    return _lineView1;
}

-(UIView *)lineView2{
    if (!_lineView2) {
        _lineView2 = [[UIView alloc] initWithFrame:CGRectMake(0, AD(60), self.whiteView.width, AD(1))];
        _lineView2.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    }
    return _lineView2;
}
-(UIView *)lineView3{
    if (!_lineView3) {
        _lineView3 = [[UIView alloc] initWithFrame:CGRectMake(0, AD(120), self.whiteView.width, AD(1))];
        _lineView3.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    }
    return _lineView3;
}
-(UIView *)lineView4{
    if (!_lineView4) {
        _lineView4 = [[UIView alloc] initWithFrame:CGRectMake(0, AD(180), self.whiteView.width, AD(1))];
        _lineView4.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    }
    return _lineView4;
}
-(UIView *)lineView5{
    if (!_lineView5) {
        _lineView5 = [[UIView alloc] initWithFrame:CGRectMake(0, AD(240), self.whiteView.width, AD(1))];
        _lineView5.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    }
    return _lineView5;
}

-(LineBtnView *)bangdanView{
    if (!_bangdanView) {
        _bangdanView = [[LineBtnView alloc] initWithFrame:CGRectMake(0, _lineView1.bottom, self.whiteView.width, AD(60))];
        _bangdanView.type = @"榜单";
    }
    return _bangdanView;
}

-(LineBtnView *)sortView{
    if (!_sortView) {
        _sortView = [[LineBtnView alloc] initWithFrame:CGRectMake(0, _bangdanView.bottom, self.whiteView.width, AD(60))];
        _sortView.type = @"排序";
    }
    return _sortView;
}
-(LineBtnView *)statusView{
    if (!_statusView) {
        _statusView = [[LineBtnView alloc] initWithFrame:CGRectMake(0, _sortView.bottom, self.whiteView.width, AD(60))];
        _statusView.type = @"状态";
    }
    return _statusView;
}
-(LineBtnView *)moreView{
    if (!_moreView) {
        _moreView = [[LineBtnView alloc] initWithFrame:CGRectMake(0, _statusView.bottom, self.whiteView.width, AD(60))];
        _moreView.type = @"更多";
    }
    return _moreView;
}
    

-(UIButton *)doneBtn{
    if (!_doneBtn) {
        _doneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_doneBtn setTitle:@"完成" forState:UIControlStateNormal];
        [_doneBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _doneBtn.titleLabel.font = [UIFont systemFontOfSize:AD(20)];
        [_doneBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        _doneBtn.layer.cornerRadius = AD(5);
        _doneBtn.clipsToBounds = YES;
        _doneBtn.frame = CGRectMake((self.width-AD(200))/2,_moreView.bottom + AD(20), AD(200), AD(50));
        _doneBtn.backgroundColor = RGB(255.0, 90.0, 117.0);
    }
    return _doneBtn;
}

@end
